//beijingyanse
export function timeFormat(value, format) {
	if (!value) {
		return false
	}
	const date = new Date(value * 1000)
	const y = date.getFullYear()
	const m = date.getMonth() + 1
	const d = date.getDate()
	const h = date.getHours()
	const min = date.getMinutes()
	const s = date.getSeconds()
	let result = ''
	if (format === undefined) {
		result = `${y}-${m < 10 ? '0' + m : m}-${d < 10 ? '0' + d : d} ${
        h < 10 ? '0' + h : h
      }:${min < 10 ? '0' + min : min}:${s < 10 ? '0' + s : s}`
	}
	if (format === 'yyyy-mm-dd') {
		result = `${y}-${m < 10 ? '0' + m : m}-${d < 10 ? '0' + d : d}`
	}
	if (format === 'yyyy/mm/dd') {
		result = `${y}/${m < 10 ? '0' + m : m}/${d < 10 ? '0' + d : d}`
	}
	if (format === 'yyyy.mm.dd') {
		result = `${y}+'.'+${m < 10 ? '0' + m : m}+'.'+${d < 10 ? '0' + d : d}`
	}
	if (format === 'yyyy-mm') {
		result = `${y}-${m < 10 ? '0' + m : m}`
	}
	if (format === 'mm-dd') {
		result = `${m < 10 ? '0' + m : m}:${d < 10 ? '0' + d : d}`
	}
	if (format === 'hh:mm') {
		result = `${h < 10 ? '0' + h : h}:${min < 10 ? '0' + min : min}`
	}
	if (format === 'yyyy') {
		result = `${y}`
	}
	if (format === 'ymd') {
		result = `${y}年${m}月${d}日`
	}
	if (format === 'yyyymmdd') {
		result = `${y}${m < 10 ? '0' + m : m}${d < 10 ? '0' + d : d}`
	}
	return result
}

